<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="昵称">
              <a-input placeholder="请输入昵称" v-model="queryParam.wxName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="头像">
              <a-input placeholder="请输入头像" v-model="queryParam.wxAvatar"></a-input>
            </a-form-item>
          </a-col>
        <template v-if="toggleSearchStatus">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="openId">
              <a-input placeholder="请输入openId" v-model="queryParam.openId"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="电话号">
              <a-input placeholder="请输入电话号" v-model="queryParam.phone"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="上级用户">
              <a-input placeholder="请输入上级用户" v-model="queryParam.onUserId"></a-input>
            </a-form-item>
          </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('推广员列表')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
      </a-dropdown>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <vtg-modal ref="modalForm" @ok="modalFormOk"></vtg-modal>
  </a-card>
</template>

<script>
  import '@/assets/less/TableExpand.less'
  import VtgModal from './modules/VtgModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'

  export default {
    name: "VtgList",
    mixins:[JeecgListMixin],
    components: {
      VtgModal
    },
    data () {
      return {
        description: '推广员列表管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
           },
		   {
            title: '昵称',
            align:"center",
            dataIndex: 'wxName'
           },
		   {
            title: '头像',
            align:"center",
            dataIndex: 'wxAvatar'
           },
		   {
            title: 'openId',
            align:"center",
            dataIndex: 'openId'
           },
		   {
            title: '电话号',
            align:"center",
            dataIndex: 'phone'
           },
		   {
            title: '上级用户',
            align:"center",
            dataIndex: 'onUserId'
           },
		   {
            title: '身份证号',
            align:"center",
            dataIndex: 'idCard'
           },
		   {
            title: '真实姓名',
            align:"center",
            dataIndex: 'realName'
           },
		   {
            title: '支付宝名字',
            align:"center",
            dataIndex: 'zfbName'
           },
		   {
            title: '支付宝账号',
            align:"center",
            dataIndex: 'zfbNumber'
           },
		   {
            title: '身份：0:代理,1:推广,2:玩家,3:平台推广',
            align:"center",
            dataIndex: 'identity'
           },
		   {
            title: '平台推广等级',
            align:"center",
            dataIndex: 'rank'
           },
		   {
            title: '0:审核中,1:审核通过，2:审核不通过,3:未申请(推广员申请)',
            align:"center",
            dataIndex: 'type'
           },
		   {
            title: '推广员申请时间',
            align:"center",
            dataIndex: 'applyTime'
           },
		   {
            title: '推广员通过时间',
            align:"center",
            dataIndex: 'exaTime'
           },
		   {
            title: '0:正常,1:拉黑',
            align:"center",
            dataIndex: 'delflag'
           },
		   {
            title: 'remark',
            align:"center",
            dataIndex: 'remark'
           },
		   {
            title: 'remark1',
            align:"center",
            dataIndex: 'remark1'
           },
		   {
            title: 'remark2',
            align:"center",
            dataIndex: 'remark2'
           },
		   {
            title: 'remark3',
            align:"center",
            dataIndex: 'remark3'
           },
		   {
            title: 'remark4',
            align:"center",
            dataIndex: 'remark4'
           },
		   {
            title: 'remark5',
            align:"center",
            dataIndex: 'remark5'
           },
		   {
            title: 'remark6',
            align:"center",
            dataIndex: 'remark6'
           },
		   {
            title: 'remark7',
            align:"center",
            dataIndex: 'remark7'
           },
		   {
            title: 'remark8',
            align:"center",
            dataIndex: 'remark8'
           },
		   {
            title: 'remark9',
            align:"center",
            dataIndex: 'remark9'
           },
		   {
            title: '分享次数（12点清0）',
            align:"center",
            dataIndex: 'remark10'
           },
		   {
            title: 'countu',
            align:"center",
            dataIndex: 'countu'
           },
		   {
            title: '累计收入',
            align:"center",
            dataIndex: 'accumulatedAmount'
           },
		   {
            title: '余额',
            align:"center",
            dataIndex: 'balance'
           },
		   {
            title: '提现中金额',
            align:"center",
            dataIndex: 'appreciating'
           },
		   {
            title: 'ljtx',
            align:"center",
            dataIndex: 'ljtx'
           },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' },
          }
        ],
		url: {
          list: "/vtg/vtg/list",
          delete: "/vtg/vtg/delete",
          deleteBatch: "/vtg/vtg/deleteBatch",
          exportXlsUrl: "vtg/vtg/exportXls",
          importExcelUrl: "vtg/vtg/importExcel",
       },
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
    methods: {
     
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>